home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / MSG Graphic Effects 1.0 Source / Full scroll L-R.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-08-23  |  2.0 KB  |  53 lines  |  [TEXT/KAHL]

  1. /*******************************************************************************
  2.  * Copyright © 1992-1993 Mark Pilgrim                                          *
  3.  *                                                                             *
  4.  * This file is provided as is, and may be freely distributed unaltered.  This *
  5.  * message must accompany any copy of this file.  This file may be used or     *
  6.  * modified for use for a non-commercial product provided that appropriate     *
  7.  * credit is given to the author named above.                                  *
  8.  * Commercial use of this source code is prohibited.                           *
  9.  ******************************************************************************/
  10.  
  11. #include "msg misc.h"
  12. #include "msg timing.h"
  13.  
  14. #define        BoxSize        20
  15. #define CorrectTime 3
  16.  
  17. void FullScrollLR(GrafPtr);
  18.  
  19. /* Take the whole screen - the righthand strip; move it into the whole screen
  20.    shifted right by BoxSize; take the righthand strip of the source window and
  21.    move it into the lefthand strip of the dest.  */
  22.    
  23. void FullScrollLR(GrafPtr sourceGrafPtr)
  24. {
  25.     int            x, y;
  26.     Rect        theRect, dest;
  27.     Rect        scrollsource, scrolldest;
  28.     
  29.     scrollsource=gMainWindow->portRect;
  30.     scrollsource.right-=BoxSize;              /* whole screen minus righthand strip */
  31.     scrolldest = scrollsource;
  32.     OffsetRect(&scrolldest, BoxSize, 0);      /* whole screen shifted +BoxSize */
  33.     
  34.     dest = gMainWindow->portRect;
  35.     dest.right=BoxSize;                       /* lefthand strip */
  36.     
  37.     theRect.top=0;
  38.     theRect.bottom=MAIN_WINDOW_HEIGHT;
  39.     theRect.left=MAIN_WINDOW_WIDTH-BoxSize;
  40.     theRect.right=MAIN_WINDOW_WIDTH;          /* source strip */
  41.     
  42.     for(x = MAIN_WINDOW_WIDTH - BoxSize; x >= 0; x -= BoxSize)
  43.     {
  44.         StartTiming();
  45.         CopyBits(&(gMainWindow->portBits), &(gMainWindow->portBits),
  46.                 &scrollsource, &scrolldest, 0, 0L);
  47.         CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
  48.                 &theRect, &dest, 0, 0L);
  49.         theRect.right-=BoxSize;
  50.         theRect.left-=BoxSize;
  51.         TimeCorrection(CorrectTime);
  52.     }
  53. }